// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.network;

import java.util.concurrent.ConcurrentLinkedQueue;

public class ZomboidNetDataPool {
    public static final ZomboidNetDataPool instance = new ZomboidNetDataPool();
    final ConcurrentLinkedQueue<ZomboidNetData> Pool = new ConcurrentLinkedQueue();

    public ZomboidNetData get() {
        ZomboidNetData zomboidNetData = (ZomboidNetData)this.Pool.poll();
        return zomboidNetData == null ? new ZomboidNetData() : zomboidNetData;
    }

    public void discard(ZomboidNetData data) {
        data.reset();
        if (data.buffer.capacity() == 2048) {
            this.Pool.add(data);
        }
    }

    public ZomboidNetData getLong(int len) {
        return new ZomboidNetData(len);
    }
}
